<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery.js" charset="utf-8"></script> <!-- 引入jquery插件 -->
    <script>
        // async function a() {
        //     return '你好'
        // }
        // a().then(res => {
        //     console.log('成功');
        // })

        function getAjax(url2) {
            return new Promise(function (resolve, reject) {
                $.ajax({
                    url: url2, //接口地址
                    success: function (res) {
                        resolve(res) //成功回调
                    },
                    error: function (err) {
                        reject(err) //失败回调
                    }
                })

            })

        }

        function getAsync1() {
            try {
                let res1 = await getAjax('data/1.json')
                let res2 = await getAjax('data/2.json')
                console.log(res1, res2);
            } catch (error) {
                console.log('抛出错误', error.status);
            }
        }
        getAsync1()

    </script>
</head>

<body>

</body>

</html>